An R Companion to Applied Regression by John Fox Sanford Weisberg

An R Companion to Applied Regression by John Fox Sanford Weisberg

Author:John Fox,Sanford Weisberg
Language: eng
Format: epub
Publisher: Sage Publications Inc.
Published: 2010-11-29T05:00:00+00:00


An alternative to changing the contrasts of individual factors is to reset the global contrasts option: for example,

> options(contrasts = c("contr.sum", "contr.poly"))

These contrast-generating functions would then be used by default for all subsequent model fits. In setting the contrasts option, we must specify contrasts for both unordered and ordered factors. Contrasts can also be set as an argument to the lm function (see Section 4.8.8).

4.6.3 ORDERED FACTORS AND ORTHOGONAL POLYNOMIALS

R has a built-in facility for working with factors that have ordered levels. The default contrast-generating function for ordered factors is contr.poly , which creates orthogonal-polynomial contrasts. Suppose, for example, that we treat the variable fcategory in the Moore data set as an ordered factor:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.